package com.mirabelle.juice.model;

import java.io.Serializable;
import javax.persistence.*;

import java.util.Date;


/**
 * The persistent class for the comment database table.
 * 
 */
@Entity
@Table(name="comment")
public class Comment implements Serializable {
	private static final long serialVersionUID = 1L;
	private Integer id;
	private String content;
	private Date created;
	private Author author;
	private Recipe recipe;

	public Comment() {
	}


	@Id
	@SequenceGenerator(name="COMMENT_ID_GENERATOR", sequenceName="SEQ_COMMENT_ID", allocationSize = 1)
	@GeneratedValue(strategy=GenerationType.IDENTITY, generator="COMMENT_ID_GENERATOR")
	@Column(unique=true, nullable=false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}


	@Column(nullable=false, length=2147483647)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}


	@Temporal(TemporalType.DATE)
	@Column(nullable=false)
	public Date getCreated() {
		return this.created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	//bi-directional many-to-one association to Author
	@ManyToOne
	@JoinColumn(name="author_id", nullable=false)
	public Author getAuthor() {
		return this.author;
	}

	public void setAuthor(Author author) {
		this.author = author;
	}


	//bi-directional many-to-one association to Recipe
	@ManyToOne
	@JoinColumn(name="recipe_id", nullable=false)
	public Recipe getRecipe() {
		return this.recipe;
	}

	public void setRecipe(Recipe recipe) {
		this.recipe = recipe;
	}

}